package cn.iocoder.yudao.module.shop.footprint.dal.mysql;

import cn.iocoder.yudao.framework.business.basic.dao.query.CoreLambdaQueryWrapper;
import cn.iocoder.yudao.framework.business.footprint.dao.FootprintMapper;
import cn.iocoder.yudao.module.shop.footprint.dal.dataobject.ShopFootprintDO;
import jakarta.annotation.Nullable;
import org.apache.ibatis.annotations.Mapper;

/**
 * 店铺浏览记录 Mapper
 *
 * @author 山野羡民（1032694760@qq.com）
 */
@Mapper
public interface ShopFootprintMapper extends FootprintMapper<ShopFootprintDO> {

    @Override
    default ShopFootprintDO selectOneByBizIdAndUserId(Long bizId, Long userId, @Nullable Boolean recycled) {
        CoreLambdaQueryWrapper<ShopFootprintDO> wrapper = new CoreLambdaQueryWrapper<>();
        wrapper.eq(ShopFootprintDO::getShopId, bizId);
        wrapper.eq(ShopFootprintDO::getUserId, userId);
        wrapper.eqIfPresent(ShopFootprintDO::getRecycled, recycled);
        wrapper.limitN(1);
        return selectOne(wrapper);
    }

}
